package com.lunatic.shiro.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lunatic.shiro.mapper.AccountMapper;
import com.lunatic.shiro.pojo.Account;
import com.lunatic.shiro.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountMapper accountMapper;


    @Override
    public List<Account> ACCOUNT_LIST() {
        return accountMapper.selectList(null);
    }

    @Override
    public Account FIND_BY_ID(Integer id) {
        return accountMapper.selectById(id);
    }

    @Override
    public Account FIND_BY_NAME(String name) {
        QueryWrapper<Account> wrapper = new QueryWrapper<>();
        wrapper.eq("username", name);
        return accountMapper.selectOne(wrapper);
    }
}
